package chapter9;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-20 上午10:32
 */
public class TestDemo {
    private static final Logger LOGGER = LoggerFactory.getLogger(TestDemo.class);

    public static void main(String[] args) {
//        MyThread thread1 = new MyThread("线程1");
//        MyThread thread2 = new MyThread("线程2");
//        MyThread thread3 = new MyThread("线程3");
//
//        thread1.start();
//        thread2.start();
//        thread3.start();

        /*
        MyThread2 thread4 = new MyThread2("线程4");
        MyThread2 thread5 = new MyThread2("线程5");
        MyThread2 thread6 = new MyThread2("线程6");

        Thread t1 = new Thread(thread4);
        Thread t2 = new Thread(thread5);
        Thread t3 = new Thread(thread6);

        t3.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);
        t1.setPriority(Thread.NORM_PRIORITY);

        t1.start();
        t2.start();
        t3.start();
        */

        TicketThread3 ticketThread = new TicketThread3();
        new Thread(ticketThread).start();
        new Thread(ticketThread).start();
        new Thread(ticketThread).start();
        new Thread(ticketThread).start();

//        TicketThread2 mt1 = new TicketThread2("thread-a");
//        TicketThread2 mt2 = new TicketThread2("thread-b");
//
//        FutureTask<String> task1 = new FutureTask<>(mt1);
//        FutureTask<String> task2 = new FutureTask<>(mt2);
//
//        new Thread(task1).start();
//        new Thread(task1).start();
//
//        try {
//            LOGGER.info("task1 result:{}", task1.get());
//            LOGGER.info("task1 result:{}", task2.get());
//        } catch (InterruptedException | ExecutionException e) {
//            e.printStackTrace();
//        }
    }
}
